/**
 * X-COM mouse class
 */
class UFOD_GFx_MouseCursor extends GFxMoviePlayer;

//=============================================================================
// Variables
//=============================================================================
var private vector2D ViewportSize;
var private vector2D MousePos;
var private float RealScaleX, RealScaleY;

//=============================================================================
// Functions: General
//=============================================================================
function Init(optional LocalPlayer LocPlay)
{
	super.Init(LocPlay);
	Start();
	Advance(0.f);
	GetScreenParams();
	SetMouseCoordsToScreenCenter();
}

//=============================================================================
// Functions: General
//=============================================================================
public function vector2D GetViewportSize()
{
	return ViewportSize;
}

public function vector2D GetMouseCoords()
{
	local Vector2D lMousePos;
	lMousePos.X = int(MousePos.X * RealScaleX);
	lMousePos.Y = int(MousePos.Y * RealScaleY);
	return lMousePos;
}

private function GetScreenParams()
{
	local float lx0, lx1, ly0, ly1;

	GetGameViewportClient().GetViewportSize(ViewportSize);
	GetVisibleFrameRect(lx0, ly0, lx1, ly1);

	lx0 = abs(lx0);
	ly0 = abs(ly0);
	lx1 = abs(lx1);
	ly1 = abs(ly1);

	RealScaleX = ViewportSize.X / (lx1 - lx0);
	RealScaleY = ViewportSize.Y / (ly1 - ly0);
}

//=============================================================================
// Functions: UnrealScript functions calls from ActionScript
//=============================================================================
function ReceiveMouseCoords( float xx, float yy )
{
	MousePos.X = xx;
	MousePos.Y = yy;
}

//=============================================================================
// Functions: ActionScript functions calls
//=============================================================================
public function DrawRotatedCursor(bool bRotating)
{
	SetMouseCoordsToScreenCenter();
	ActionScriptVoid("DrawRotatedCursor");
}

public function DrawAttackingCursor(bool bAttaking)
{
    ActionScriptVoid("DrawAttackingCursor");
}

public function DrawTeleportingCursor(bool bTeleporting)
{
    ActionScriptVoid("DrawTeleportingCursor");
}



public function UpdateMousePosition()
{
	ActionScriptVoid("UpdateMousePosition");
}

public function ShowMouseCursor(bool bShow)
{
	ActionScriptVoid("ShowMouseCursor");
}
{
	mDLLAPI.SetMousePosition(ViewportSize.X/2, ViewportSize.Y/2);
	UpdateMousePosition();
}

//=============================================================================
// Default Properties:
//=============================================================================
DefaultProperties
{
	// The path to the swf asset
	MovieInfo = SwfMovie'xLED_UI.Mouse'

	bIgnoreMouseInput = False // this determines whether the mouse is captured or not
    bCaptureInput = False

	bPauseGameWhileActive = False // do you want your game paused when this is open? //overriden in menu type selection

    bDisplayWithHudOff = False // do you want the HUD displayed while this is open?

    TimingMode=TM_Real
}